package com.leyou.auth.web;

import com.leyou.auth.service.ClientInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author mySun
 * @create 2021-07-28 17:45
 */
@RestController
@RequestMapping("/client")
public class ClientInfoController {

    @Autowired
    private ClientInfoService clientInfoService;

    /**
     * 给其他服务获取jwt秘钥
     * @param clientId 客户端id
     * @param secret 密码
     * @return
     */
    @GetMapping("/key")
    public ResponseEntity<String> getKey(
            @RequestParam("clientId") String clientId,
            @RequestParam("secret") String secret
    ){
        return ResponseEntity.ok(clientInfoService.getKey(clientId,secret));
    }
}
